using FinallyArchive__Application;
using FinallyArchive__Application.CURDBaseService;
using FinallyArchive__Dto;
using FinallyArchive__Model;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<FinallyArchiveContext>(s => s.UseSqlServer(builder.Configuration.GetConnectionString("SqlConn")));
builder.Services.AddTransient<IBaseService<User, UserInputDto, UserOutputDto, UserSearchDto, int>, BaseService<User, UserInputDto, UserOutputDto, UserSearchDto, int>>();
builder.Services.AddTransient<IUserService, UserService>();
var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();
